﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;
using System.Xml;

namespace GameBanChim_Version1
{
    public class LevelIntro : Dialog
    {
        SpriteFont _font;

        int _gameLevel;

        // 1 vòng 30s
        int _updateCountOfSecond = 30;
        int _iUpdateCountOfSecond;

        // draw: 0 == intro, 1,2,3,4: GO, 5 == end intro
        int _whatToDraw;

        bool _finish = false;

        public bool Finish
        {
            get { return _finish; }
            set { _finish = value; }
        }

        public LevelIntro(int level, ContentManager _content)
        {
            _gameLevel = level;
            X = 300;
            Y = 250;
            _font = _content.Load<SpriteFont>("LargeFont");
        }

        public override void Update(GameTime gameTime)
        {
            if (_iUpdateCountOfSecond == _updateCountOfSecond)
            {
                _iUpdateCountOfSecond = 0;
                _whatToDraw++;
                if (_whatToDraw == 5)
                {
                    _finish = true;
                }
            }
            else
                _iUpdateCountOfSecond++;
            //base.Update(gameTime);
        }

        public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            if (_finish)
            {
                return;
            }           
            switch (_whatToDraw)
            {
                case 0:
                    {
                        spriteBatch.DrawString(_font, "Level " + _gameLevel.ToString(), new Vector2(X, Y), Color.Red);
                        break;
                    }
                case 1:
                    {
                        spriteBatch.DrawString(_font, "     " + (3).ToString(), new Vector2(X, Y), Color.Green);
                        break;
                    }
                case 2:
                    {
                        spriteBatch.DrawString(_font, "     " + (2).ToString(), new Vector2(X, Y), Color.Green);
                        break;
                    }
                case 3:
                    {
                        spriteBatch.DrawString(_font, "     " + (1).ToString(), new Vector2(X, Y), Color.Green);
                        break;
                    }
                case 4:
                    {
                        spriteBatch.DrawString(_font, "   Go!", new Vector2(X, Y), Color.Green);
                        break;
                    }
            }

            //base.Draw(gameTime, spriteBatch);
        }
    }
}
